#define _CRT_SECURE_NO_WARNINGS 1

#include<iostream>
using namespace std;

class A
{
public:
	A()
	{
		cout << "A" << endl;
	}

	virtual~A()
	{
		cout << "~A" << endl;
	}

	virtual void fun()
	{
		cout << "funA" << endl;
	}
};

class B:public A
{
public:

	B()
	{
		cout << "B" << endl;
	}
	virtual~B()
	{
		cout << "~B" << endl;
	}

	virtual void fun()
	{
		cout << "funB" << endl;
	}
};

void fun(A& a)
{
	a.fun();
}

int main()
{
	//A a;
	B b;
	b.fun();
	/*A& ab = b;
	fun(a);
	fun(ab);*/
	/*A* ptra = new A;
	A* ptrb = new B;*/

	/*delete ptra;
	delete ptrb;*/
	return 0;
}